﻿@model ProjectManagement.Domain.Entities.User

@{
    ViewBag.Title = "新增用户";
	Layout = null;
}

 <link href="@Url.Content("~/Content/images/right.css")" rel="stylesheet" type="text/css" />
 <script src="@Url.Content("~/Scripts/jquery-1.7.2.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script type="text/javascript">
	$(function () {
		$("#Provience").change(function () {
			var sto = $(this).find("option:selected").val();
			if (sto == "") {
				$('#Provience').val(0);
				$('#City').val(0);
			}
			else {
				$.ajax({
					url: 'GetSelectedList',
					type: 'Post',
					data: { id: sto },
					success: function (result) {
						$('#City').empty();
						$.each(result, function (i) {
							$("#City").append("<option value='" + result[i]["ID"] + "'>" + result[i]["Name"] + "</option>");
						});
					}
				});
			}
		});
	})
</script>
@using (Html.BeginForm("EditUsers", "SysManage", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>填写用户信息</legend>
<div style="width:1000px">
	<div class="left">
        <div class="editorlabel">
            @Html.LabelFor(model => model.UserName)
        </div>
        <div class="editorfield">
            @Html.EditorFor(model => model.UserName)
            @Html.ValidationMessageFor(model => model.UserName)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.RealName)
        </div>
        <div class="editorfield">
            @Html.EditorFor(model => model.RealName)
            @Html.ValidationMessageFor(model => model.RealName)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.Password)
        </div>
        <div class="editorfield">
            @Html.EditorFor(model => model.Password)
            @Html.ValidationMessageFor(model => model.Password)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.Birthday)
        </div>
        <div class="editorfield">
            @Html.EditorFor(model => model.Birthday)
            @Html.ValidationMessageFor(model => model.Birthday)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.Sex)
        </div>
        <div class="editorfield">
            @Html.DropDownListFor(model => model.Sex,Html.SexHelper())
            @Html.ValidationMessageFor(model => model.Sex)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.Email)
        </div>
        <div class="editorfield">
            @Html.EditorFor(model => model.Email)
            @Html.ValidationMessageFor(model => model.Email)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.MobilePhone)
        </div>
        <div class="editorfield">
            @Html.EditorFor(model => model.MobilePhone)
            @Html.ValidationMessageFor(model => model.MobilePhone)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.ImageUrl)
            <input type="file" value="" name="image" />
			
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.Provience)
			@Html.DropDownListFor(model => model.Provience, Html.ProvienceHelper())
            @Html.ValidationMessageFor(model => model.Provience)
			@Html.LabelFor(model => model.City)
			<select id="City" name="City">
				<option value="0">请选择</option>
			</select>
            @Html.ValidationMessageFor(model => model.City)
        </div>

        <div class="editorlabel">
            @Html.LabelFor(model => model.Address)
        </div>
        <div class="editorfield">
            @Html.EditorFor(model => model.Address)
            @Html.ValidationMessageFor(model => model.Address)
        </div>
		<p>@Html.HiddenFor(model => model.RegisterTime)
		   @Html.HiddenFor((model => model.LastLogonTime))
		   @Html.HiddenFor(model => model.IP)
		</p>
        <p>
            <input type="submit" value="保存" />
        </p>
	</div>
	<div class="clear"></div>
	<div class="right">
	@if (Model.ImageUrl == null)
 {
			 <img src="" />
 }
 else
 {
	 <img src="@Model.ImageUrl" /> 
 }
	
	</div>
</div>
    </fieldset>
}

<div>
    @Html.ActionLink("返回列表", "UserList")
</div>
